package com.laguille.games.monopoly.commons.property;



public class PropertyImpl implements Property {

	private final String name;
	private final int buyingPrice;
	private final int rentingPrice;
	
	public PropertyImpl(String name, int buyingPrice, int rentingPrice) {
		this.name = name;
		this.buyingPrice = buyingPrice;
		this.rentingPrice = rentingPrice;
	}

	public String getName() {
		return name;
	}

	public int getBuyingPrice() {
		return buyingPrice;
	}

	public int getDefaultRentingPrice() {
		return rentingPrice;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + buyingPrice;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + rentingPrice;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PropertyImpl other = (PropertyImpl) obj;
		if (buyingPrice != other.buyingPrice)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (rentingPrice != other.rentingPrice)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "PropertyImpl [name=" + name + ", buyingPrice=" + buyingPrice
				+ ", rentingPrice=" + rentingPrice + "]";
	}

	
}
